package week_02.Array;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.*;

public class find_Array {
    public static void main(String[] args) throws
            IOException {
        String pathName = "src\\week_02\\gather\\1w random number.txt";
        FileReader fileReader = new FileReader(pathName);
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        String textLine = "";
        String str = "";
        while ((textLine = bufferedReader.readLine()) != null) {
            str += textLine;
        }
        Integer[] a = new Integer[10];
        ArrayList<Integer> b = new ArrayList<>();
        String[] arr = str.split(",");
        for (int i = 0; i < a.length; i++) {
            a[i] = Integer.parseInt(arr[i]);
        }
        //把数组放到泛型数组里面
        b.addAll(Arrays.asList(a));
        Scanner i = new Scanner(System.in);
        System.out.println("输入要查找的数字:");
        int x=i.nextInt();
        if (b.contains(x)){
            System.out.println("该数字在数组中存在");
        }else {
            System.out.println("该数字在数组中不存在");
        }
    }
}
